// 1.引入axios对象
import request from '@/utils/request'
import type { CategoryListModel } from './model/categoryModel'

// 2.引入ts类型约束
// 3.使用枚举进行统一接口API管理
enum Api{
  // 一级导航
  getCategory1Id = '/admin/product/getCategory1',
  // 二级导航
  getCategory2Id = '/admin/product/getCategory2',
  // 三级导航
  getCategory3Id ='/admin/product/getCategory3'
}
// 4.获取一级导航数据
export const reqGetCategory1ListData = ()=>{ return request.get<any,CategoryListModel>(Api.getCategory1Id) }
// 5.获取二级导航数据
export const reqGetCategory2ListData =(category1Id:number)=>{ return request.get<any,CategoryListModel>(`${Api.getCategory2Id}/${category1Id}`)}
// 6.获取三级导航数据
export const reqGetCategory3ListData =(category2Id:number)=>{return request.get<any,CategoryListModel>(`${Api.getCategory3Id}/${category2Id}`)}